/** 
 * <b>allocates Memory any second until counter is reached</b>
 * <>number of bytes is == SIN(System.seconds /90)*1M<>
 * @author      vipup<br>
 * <br>
 * <b>Copyright:</b>     Copyright (c) 2006-2008 Monster AG <br>
 * <b>Company:</b>       Monster AG  <br>
 * 
 * Creation:  05.04.2011::09:38:44<br> 
 */
public class YourMainClass {
	/**
	 * possible parm is Number == number of seconds to keep running.
	 * @author vipup
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String []args) throws InterruptedException{
		int keepRunningCounter = 10*60;
		try{
			keepRunningCounter  = Integer.parseInt( args[0] );
		}catch(Exception e){//ignore error
			System.err.println(e.getMessage());
			System.err.println("param is wrong. user #"+YourMainClass.class.getName()+" <seconds_to_run>");
			System.err.println("for ex.#"+YourMainClass.class.getName()+" 100");
		}
		String data = "";
		for (int i=0; i<keepRunningCounter ;i++){
			double radTmp = (1.0*System.currentTimeMillis())/1000/90;
			int size =2*1024 - (int)(Math.sin(radTmp )*1024);
			byte[]buf = new byte[size*1024];
			data = new String(buf);
			System.out.println("allocated:"+data.length());
			System.gc();
			Thread.sleep(1000);
			
		}
	}
	
}


 